﻿Imports System.Data
Imports VSModel
Imports Cls_Common
Imports SecurityService
Partial Class Control_MSDS_Section11View
    Inherits System.Web.UI.UserControl
#Region "EVENT FOR CONTROL"

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        If Not IsPostBack Then

            Translate()
            Me.EnableViewState = False
            If Not Request.QueryString("Id").ToString.Equals("0") Then
                hidMSDSID.Value = Request.QueryString("Id")
            End If
            CheckData()
        End If
    End Sub
    Protected Sub Translate()
        lbSection11Title.Text = getTranslate("lbSection11Title", Session("LanguageId"), lbSection11Title.Text)
        lbSection11TenTP.Text = getTranslate("lbSection11TenTP", Session("LanguageId"), lbSection11TenTP.Text)
        lbSection11LoaiNguong.Text = getTranslate("lbSection11LoaiNguong", Session("LanguageId"), lbSection11LoaiNguong.Text)
        lbSection11KQ.Text = getTranslate("lbSection11KQ", Session("LanguageId"), lbSection11KQ.Text)
        lbSection11DuongTiepXuc.Text = getTranslate("lbSection11DuongTiepXuc", Session("LanguageId"), lbSection11DuongTiepXuc.Text)
        lbSection11SinhVatThu.Text = getTranslate("lbSection11SinhVatThu", Session("LanguageId"), lbSection11SinhVatThu.Text)
        lbSection11lbCacAnhHuong.Text = getTranslate("lbSection11lbCacAnhHuong", Session("LanguageId"), lbSection11lbCacAnhHuong.Text)
        lbSection11lbAnhHuongDocKhac.Text = getTranslate("lbSection11lbAnhHuongDocKhac", Session("LanguageId"), lbSection11lbAnhHuongDocKhac.Text)
    End Sub
    
#End Region
#Region "PRIAVTE SUB AND FUNCTION"
    Sub CheckData()
        Using data As New VSEntities
            Dim LanguageId = Session("LanguageId").ToString()
            Dim p = (From q In data.MSDSSection11 Where q.LanguageId = LanguageId And q.MSDSId = hidMSDSID.Value).FirstOrDefault()
            If Not p Is Nothing Then
                txtS1110.Text = p.S1110
                txtS1111.Text = p.S1111
                txtS1112.Text = p.S1112
                txtS1113.Text = p.S1113
                txtS1114.Text = p.S1114

                txtS1120.Text = p.S1120
                txtS1121.Text = p.S1121
                txtS1122.Text = p.S1122
                txtS1123.Text = p.S1123
                txtS1124.Text = p.S1124

                txtS1130.Text = p.S1130
                txtS1131.Text = p.S1131
                txtS1132.Text = p.S1132
                txtS1133.Text = p.S1133
                txtS1134.Text = p.S1134

                txtS1141.Text = p.S1141
                txtS1151.Text = p.S1151
                hidID.Value = p.Section11Id
            End If
        End Using
    End Sub
#End Region
End Class
